<?php
namespace app\admin\controller;

use think\Controller;
use think\Db;
use app\admin\model\Admin as AdminModel;

class Login extends Controller
{
    public function index()
    {
		if(request()->isPost()){
			$admin = new AdminModel();
			$data = input('post.');
			$num = $admin->login($data);
			if($num==3){
				$this->success('登录成功','index/index');
			}else if($num==4){
				$this->error('验证码错误','login/index');
			}
			else{
				$this->error('用户名或密码错误','login/index');
			}
		}
        return $this->fetch('login');
    }
}
